<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
  $(function(){
	  $('#useradd_role').combobox({
			url : '${pageContext.request.contextPath}/roleAction!do_combobox.action',
			required:true,
			editable:false,
			panelHeight:'auto',
			valueField:'cid',  
			textField:'cname',
			checkbox : true,
			multiple:true,
			formatter: function (row) {
                var opts = $(this).combobox('options');
                return '<input type="checkbox" class="combobox-checkbox">' + row[opts.textField];
            },
            onLoadSuccess: function () {
                var opts = $(this).combobox('options');
                var target = this;
                var values = $(target).combobox('getValues');
                $.map(values, function (value) {
                    var el = opts.finder.getEl(target, value);
                    el.find('input.combobox-checkbox')._propAttr('checked', true);
                });
            },
            onSelect: function (row) {
                var opts = $(this).combobox('options');
                var el = opts.finder.getEl(this, row[opts.valueField]);
                el.find('input.combobox-checkbox')._propAttr('checked', true);
            },
            onUnselect: function (row) {
                var opts = $(this).combobox('options');
                var el = opts.finder.getEl(this, row[opts.valueField]);
                el.find('input.combobox-checkbox')._propAttr('checked', false);
            }
    	});
  });
</script>
<div align="center" style="padding:5px">
	<form method="post" id="useradd_form">
		<table  class="t2">
			<tr>
				<th>所属机构：</th>
				<td colspan="3"><input id="useradd_dept" class="easyui-combotree" name="deptid" data-options="editable:false,lines:true,idField:'id',textField:'text',parentField:'pid',url:'deptAction!do_combotree.action',panelHeight:'180',required:true" style="width:380px" />
				</td>
			</tr>
			<tr>
				<th width="80">用户姓名：</th>
				<td width="150"><input type="text" name="cname" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写用户名！'" style="width:150px"/>
				</td>
				<th width="80">用户编号：</th>
				<td width="150"><input type="text" name="cbh" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写用户编号！'" style="width:150px"/>
				</td>
			</tr>
			<tr>
				<th>用户密码：</th>
				<td><input type="password" name="cpwd" class="easyui-validatebox" data-options="required:'true',missingMessage:'请填写登录密码'"  style="width:150px"/>
				</td>
				<th>重复密码：</th>
				<td><input type="password" name="cpwd2" class="easyui-validatebox" data-options="required:'true',missingMessage:'请再次填写密码',validType:'eqPassword[\'#useradd_form input[name=cpwd]\']'" style="width:150px"/>
				</td>
			</tr>
			<tr>
				<th>员工类别：</th>
				<td><input type="text" class="easyui-combobox" name="yglbid" data-options="url:'yglbAction!do_combobox.action',panelHeight:'auto',required:true,valueField:'cid',textField:'cname'" style="width:150px" /></td>
				<th>用户角色：</th>
				<td ><input type="text" id="useradd_role"  name="roleIds"  style="width:150px"/></td>
			</tr>
		</table>
	</form>
</div>